Skip to content

FIX-2154: the Teammates lab remembers past its history window, and draws the divider (with FIX-1613) - #4124

Merged
jhoffner merged 82 commits into
mainfrom
claude/project-thread-6ydn0c
Oct 29, 2026
Merged

jhoffner merged 82 commits into
mainfrom
claude/project-thread-6ydn0c

Conversation

@jhoffner

@jhoffner jhoffner commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Jake · project thread

What this does

This is the last piece of the Grok Bot-style lab (FIX-2154 goal step 4). A worker's conversation now lasts past its 50-turn history window. Before a turn leaves the window, it is folded into a running summary. The screen draws a divider labelled Earlier turns summarized at the point where the worker starts reading word for word.

The base is main. #4085 (FIX-1613, the history summary) and #4086 have both merged, so the diff is now only the lab and the goal.

  • labs/teammates/host.mts: adds utility.historySummary({ summarize: utility.summarizer(...) }). Its capability goes in the agent flow's uses, and its fold runs as beforeAnswer. The summarizer's objectives name its input (the summary so far plus the newer turns) and say its summary replaces the old one, so later folds keep earlier facts.
  • labs/teammates/src/adapter.ts: watchWindow reads the last answering request's historyStart and the session's historySummary resource. The divider sits at whichever comes later: the window's first turn, or the first turn that started after the summary's mark. It always uses the mark, because history reads from there even when the summary has a hole. It says summarized only when the summary is complete and reaches that point.
  • test/window-mark.test.ts: covers where the divider sits and what it says, including overlapping turns and a summary with a hole. Each of those cases fails without its fix (checked).
  • Goal step 4 in goals/teammates-lab/a-worker-talks-to-another-while-you-talk: the user gives a codename, then 60 more lines, then asks for the codename and the launch date back. The step also checks that lead didn't message researcher again, the divider's label, and that both facts are drawn above the divider. If lead files the codename as a standing rule, the step fails, because a rule never leaves the model's view. Each turn waits until the streamed answer has finished drawing.
  • New controls: no-summary (summary removed, memory kept) and no-memory (both removed).
  • 8fbfca6 (Jake): a worker message that arrives is now stored as a user line in the recipient's history.
  • README: adds the divider row and removes the "not wired yet" bullet.

Evidence

Real model runs (openai/gpt-5.4-mini, with Claude Code as coder), from the goal's verdict log:

  • PASS on steps 1 to 5 three times: 068ae50, a2caae9, and 00e8f07 (with streamed answers). Step 4 recovered "cobalt walrus 608" / 17 September, "umber badger 214" / 4 December, and "cobalt gecko 377" / 22 February.
  • no-summary and no-memory: step 4 FAILS, answering "I don't have that information", and the divider reads "Earlier turns out of view".
  • Lab tests (34), typecheck and inventory are clean on the merged head, and CI is green on 1202202.

No changeset: the lab is private.


🤖 Generated with Claude Code

https://claude.ai/code/session_01NczDiH8mBQVAHJ3u5iz8VL

claude added 30 commits October 28, 2026 18:34
…w reads (FIX-1613)

Each turn records historyStart on its request once earlier turns fall out of
its history window (one extra row read tells). Blocks get a read-only
ctx.session.window, history({ afterRequestId }), and items.turns() listing
the window's turns and open ones, or named turns by id within the session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
…ory key (FIX-1613)

utility.historySummary({ summarize }) returns a capability (a session resource
holding the running summary, the summary as context, history read after its
mark) and a fold step the flow runs before the answering generator. The fold
starts while the oldest unfolded turn is in the oldest quarter of the window,
keeps unsettled turns by id and folds them once they settle, and writes with a
version check. Capabilities gain a generator-only history preset key that
narrows every history read of the block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
…ent type (FIX-1613)

The agent worker flow runs an app's beforeAnswer block before the worker
answers, where a history summary's fold goes. The client's request summary
carries historyStart, and a route test proves it reaches a screen. The
history preset key joins the dynamic keys a worker may pick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
The lab now runs on a real model and a durable SQLite store through
`fsdev dev --app`: lead, researcher and writer on the built-in agent flow
with memory composed in, coder on the lab's one coding flow (one
harnessManager per harness over projectWorkspace(), routed by the worker's
`harness:`), and the user's projects created at start. The adapter calls
the workforce client, session items and streams, the message log, and
setWorkProject; the fixtures are gone (kept only as a test double).

Adds the goal check goals/teammates-lab/a-worker-talks-to-another-while-you-talk
(steps 1-3 and 5 in a browser; step 4 waits on FIX-1613), and lets
launchChromium find a pre-installed chrome-linux64 build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
Opens the page on the first worker you can talk to, shows "idle" before a
worker's first turn, opens the roster before reading projects (a fresh
store had none to list yet), and labels a pending run without a project.
lead's WORKER.md now says to file code changes with a title and goal and
nothing in `input` (FIX-2282). The goal grades step 5 on its own task cards
and records PASS twice plus all four controls failing their steps. The
README lists what isn't wired: G1 (FIX-1613), FIX-2280, FIX-2281, FIX-2282.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
fsdev loads fsdev.config.mts by path, so nothing imports it; like
knowledge-hub's, it is an entry point.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
- watchWorkProject reads the last setWorkProject answer once, over every
  page of finished requests, then follows the picks made on this page, in
  place of re-reading 200 requests with their output every 1.5 s.
- watchRun's run session comes from the task rows watchTasks reads, and its
  wait stops once the run's feed is attached.
- The goal waits for coder's result after your pick, not the refused task's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
… paged

Each later page starts on the last item held, as useSession reads it; a page
that doesn't means a keyed item moved and an older one may have been
skipped, so the read starts over. The new test loses item 10 of 502 on the
old read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
CODEX_PASS moves from the kitchen sink into @flow-state-dev/codex, next to
claude-code's CLAUDE_CODE_PASS, and the Teammates lab's codex harness builds
client.env from it instead of inheriting the server's whole process.env.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
watchRun takes the run session the task row names, so the runOf map and its
wait poll go. The README inventory is regenerated, which ed88b9f's host.mts
change had left stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
…rns mark the summary incomplete (FIX-1613)

A summary whose fold kept failing never wrote nextRequestId or gap, so turns
left the window unsummarized while the resource still read complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
…t (FIX-1613)

A summary can move its mark past a waiting turn. That turn is not among the
settled turns history reads, so the narrowing fell back to the whole window
and the model read summarized turns again. The mark is now found among every
turn, unsettled ones included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
…e that moved the mark (FIX-1613)

A fold of settled pending turns leaves the mark where it is, so a slower fold
read before it passed the mark check and wrote back over it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
…raws the divider

lead, researcher and writer install core's historySummary capability and run
its fold before they answer. The divider reads the last answering request's
historyStart and the session's historySummary mark, and is labelled
summarized only when the summary reaches the window. Goal step 4 runs 60
lines past the window, with controls no-summary and no-memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiH8mBQVAHJ3u5iz8VL
…(FIX-1613)

Core's summarizer returns { summary, keyPoints? } and a real model put the
launch date and codename in keyPoints alone; the fold kept only summary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
…e mark leaves the window

When the mark is gone from the window, find the turns after it by the
position of the oldest turn the last fold left unfolded, before falling
back to the start-time compare.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
The store lists turns newest first with an id tie-break; trimming the
lookahead row after a start-time-only sort could keep a different turn
than before when two turns tie at the window's edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
Window turns and open turns were merged with a start-time-only sort, so a
turn that settled could move to the other side of a sibling a summary's
mark had already passed. One comparator, start time then id, now orders
every turn list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
A worker's answer, a message from another worker and a task's result are drawn
through the UI registry's MessageResponse (Streamdown), copied into the lab's
flow-state components. An unfinished code fence renders as a code block while
the answer streams. Streamdown parses raw HTML by default; the lab drops its
raw rehype plugin so HTML a model writes shows as text. Tests cover the open
fence, Markdown structure and the HTML, and fail on the plain-text entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
… facts

The goal's lines now wait for their own answer, and a codename kept as a
standing rule fails the step. The lab's summarizer is told its summary replaces
the one so far, so a fold never drops the launch facts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiH8mBQVAHJ3u5iz8VL
A request whose window loaded before another request folded past all of it
read those turns again beside the summary, because a mark not in the
window was taken to be older than it. afterRequestId now reads the mark by
id and keeps the turns after it by start time then id; the fold no longer
records a gap when the turn after the mark is newer than its window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
A fold took a quarter of the window's turns, waiting ones included, so
enough older waiting turns held every settled turn back until it left the
window. The quarter now counts settled turns; waiting turns on the way
move to pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs
A request that finished between this request's window load and its fold
was in neither read, so a fold could move its mark past it unseen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEHd9ZKT1vum6nfnPs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bee72e8d91

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread labs/teammates/src/adapter.ts Resolved
Overlapping turns interleave their items, so the summarized turn's last item
can sit after a newer turn's first: the divider then marked that newer turn
as summarized though the worker still reads it word for word. The divider now
goes before the first turn that started after the summary's mark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiH8mBQVAHJ3u5iz8VL
jhoffner pushed a commit that referenced this pull request Oct 28, 2026
…n first

The budget is only the tool's hard cut; sessions.history takes a limit.
Consulted turns reach the generator as quoted history, never instructions.
The settled-turns extraction lands first as a no-behaviour PR. The core
tool's one caller is the Workforce capability. #4085 has merged; #4124
also edits the Teammates lab's host.mts uses line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDDcHFmFvB4LDAad5t

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 129959f882

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread labs/teammates/src/adapter.ts Resolved
…rops the label

The history capability reads after throughRequestId whether or not the
summary is complete, so the divider sits there too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiH8mBQVAHJ3u5iz8VL
@jhoffner

Copy link
Copy Markdown
Collaborator Author

@claude resolve conflicts

…-6ydn0c

# Conflicts:
#	goals/teammates-lab/a-worker-talks-to-another-while-you-talk/goal.md
#	labs/teammates/README.md

Copy link
Copy Markdown
Collaborator Author

I merged main and resolved the conflicts (5d93f27):

  • In the goal's verdict log, I kept both sets of rows, including main's FIX-2308 theme PASS.
  • I regenerated the lab README's inventory table.

The lab tests (34) and typecheck pass locally. CI is running on the new head.


Generated by Claude Code

@jhoffner

Copy link
Copy Markdown
Collaborator Author

@claude resolve conflicts

…-6ydn0c

# Conflicts:
#	goals/teammates-lab/a-worker-talks-to-another-while-you-talk/goal.md
#	goals/teammates-lab/a-worker-talks-to-another-while-you-talk/run.mts
#	labs/teammates/README.md
#	labs/teammates/host.mts
#	labs/teammates/src/adapter.ts

Copy link
Copy Markdown
Collaborator Author

I merged main and resolved the conflicts with FIX-2309, which made the workers real (5e1a3f9).

  • host.mts: the agent flow now has FIX-2309's tool catalog and project-workspace capability, plus the history summary (earlier.capability in uses, beforeAnswer: earlier.fold).
  • adapter.ts: this keeps windowMarkOf and watchWindow, and adopts main's new poll(read, onValue, everyMs) signature.
  • Goal:
    • Step 4 and the no-summary and no-memory controls stay as they were, alongside main's new step 5 and its project-not-kept control. Step 4 is skipped under project-not-kept, as under the other controls that don't test it.
    • The goal's description now says the launch date comes from the project's README, which lead's tools can't read. So step 4 still relies only on the summary for the date.
  • README: keeps the history window paragraph, uses main's new step-5 text, and has its file-count table regenerated.

The lab tests (38), the lab typecheck and the goals typecheck pass locally. I'm re-running the goal on a real model against the merged code.


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiH8mBQVAHJ3u5iz8VL
@jhoffner
jhoffner merged commit f6c17e3 into main Oct 29, 2026
13 checks passed
@jhoffner
jhoffner deleted the claude/project-thread-6ydn0c branch October 29, 2026 17:20
jhoffner pushed a commit that referenced this pull request Oct 29, 2026
Conflicts with FIX-2154's step 4 (#4124): the goal keeps step 4 and its
controls, swaps no-reply-tool for no-reply-back (skipping step 4 like the
others), and keeps both sides' verdict rows. Step 3 reads the message log
once. Lab README inventory regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiGEm4kfC1pmTyV3Pz9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants